﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Runtime.Serialization;
using System.Collections;

namespace Model
{
    public class SqlApp 
    {
        private string _sql;

        public string Sql
        {
            get { return _sql; }
            set { _sql = value; }
        }

        private ArrayList _sqlParam;

        public ArrayList SqlParam
        {
            get { return _sqlParam; }
            set { _sqlParam = value; }
        }

        private bool _isAllowNull = false;

        /// <summary>
        /// 是否允许不为空
        /// </summary>
        public bool IsAllowNull
        {
            get { return _isAllowNull; }
            set { _isAllowNull = value; }
        }

        private string _errorMsg = "数据保存失败！";

        /// <summary>
        /// 出错后的提示消息
        /// </summary>
        public string ErrorMsg
        {
            get { return _errorMsg; }
            set { _errorMsg = value; }
        }
        

        public SqlApp(string _sql, ArrayList _sqlParam)
        {
            this._sql = _sql;
            this._sqlParam = _sqlParam;
        }

        public SqlApp(string _sql, object[] _sqlParam)
        {
            this._sql = _sql;
            this._sqlParam = new ArrayList(_sqlParam);
        }

        public SqlApp(string _sql, ArrayList _sqlParam,bool _isAllowNull,string _errorMsg)
        {
            this._sql = _sql;
            this._sqlParam = _sqlParam;
            this._isAllowNull = _isAllowNull;
            this._errorMsg = _errorMsg;
        }
    }
}
